local sk__wengua = fk.CreateSkill {

  name = "sk__wengua",

  tags = {  },

}



sk__wengua:addEffect(fk.EventPhaseStart, {
  name = "sk__wengua",
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(sk__wengua.name) and target.phase == Player.Start and not target.dead and not target:isNude()
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local prompt = "#sk__wengua-give:"..player.id
    if target == player then
      prompt = "#sk__wengua-draw::"..target.id
    end
    local card = room:askForCard(target, 1, 1, true, sk__wengua.name, true, ".", prompt)
    if #card > 0 then
      event:setCostData(self, card)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if target ~= player then
      room:moveCardTo(event:getCostData(self), Card.PlayerHand, player, fk.ReasonGive, sk__wengua.name, nil, false, target)
    end
    if player.dead or player:isNude() then return end
    local card
    if target == player then
      card = event:getCostData(self)
    else
      card = room:askForCard(player, 1, 1, true, sk__wengua.name, true, ".", "#sk__wengua-draw::"..target.id)
    end
    if #card > 0 then
      room:moveCards({
        ids = card,
        from = player,
        toArea = Card.DrawPile,
        moveReason = fk.ReasonPut,
        skillName = sk__wengua.name,
        drawPilePosition = -1,
      })
      if not player.dead then
        player:drawCards(1, sk__wengua.name)
      end
      if not target.dead then
        target:drawCards(1, sk__wengua.name)
      end
    end
  end,
})

return sk__wengua